<?php
session_start();
$User_ID= trim ($_SESSION['User_ID']);
?>

<?php

require_once("includes/database.php"); 


{	
$page_no = $_POST['page_no'];
$page_no = $page_no+1;
$owner_name = $_POST['owner_name'];
$pet_type = $_POST['pet_type'];
$pet_gender = $_POST['pet_gender'];
$pet_name = $_POST['pet_name'];
$pet_breed = $_POST['pet_breed'];
$pet_bday = $_POST['pet_bday'];
$unique_pet = mt_rand();
date_default_timezone_set ("Asia/Hong_Kong");
$timezone= date_default_timezone_get();

$date =date("Y/m/d");



$tsql="INSERT INTO pet_info_db(Page_No_User,Pet_Type,Pet_Gender,Pet_Name,Pet_Breed,Pet_Birthday,Pet_Owner,Owner_User_ID,Pet_ID) 
Values('{$page_no}','{$pet_type}','{$pet_gender}','{$pet_name}','{$pet_breed}','{$pet_bday}','{$owner_name}','{$User_ID}','{$unique_pet}')";

mysql_query($tsql);

$clientId = mysql_insert_id(); 

$tsql="INSERT INTO pet_info_null_db(Pet_Type,Pet_Gender,Pet_Name,Pet_Breed,Pet_Birthday,Pet_Owner,Owner_User_ID,Pet_ID) 
Values('{$pet_type}','{$pet_gender}','{$pet_name}','{$pet_breed}','{$pet_bday}','{$owner_name}','{$User_ID}','{$unique_pet}')";

mysql_query($tsql);

$clientId = mysql_insert_id(); 

$tsql="INSERT INTO vaccine_db(Owner_User_ID,Owner_Name,Pet_ID)
Values('{$User_ID}','{$owner_name}','{$unique_pet}')";





$data =  mysql_query($tsql,$con);

if( $data )
{
     /*echo "Connection established.\n";*/
	 $message = "Registration Successful!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_user_page.php?page=1&pet_id=';</script>";
}
else
{
    $message = "Registration Failed. Check information.!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_user_page.php?page=1&pet_id=';</script>";
     die( print_r( mysql_error(), true));
}
}

?>